<%@ taglib prefix="iwebmvc" uri="http://tags.iwebmvc.com" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %>
<c-rt:set var="totalActivity" value="<%= org.internna.iwebjtracker.services.ActivityReporter.TOTAL_ACTIVITY %>" />
<c-rt:set var="totalProjects" value="<%= org.internna.iwebjtracker.services.ActivityReporter.TOTAL_PROJECTS %>" />
<c-rt:set var="totalDevelopers" value="<%= org.internna.iwebjtracker.services.ActivityReporter.TOTAL_DEVELOPERS %>" />
<c-rt:set var="totalOpenIssues" value="<%= org.internna.iwebjtracker.services.ActivityReporter.TOTAL_OPEN_ISSUES %>" />
<c-rt:set var="totalAssigned" value="<%= org.internna.iwebjtracker.services.ActivityReporter.TOTAL_ASSIGNED %>" />
<c-rt:set var="totalCritical" value="<%= org.internna.iwebjtracker.services.ActivityReporter.TOTAL_CRITICAL_OPEN_ISSUES %>" />
<c-rt:set var="activityClass" value="<%= org.internna.iwebjtracker.model.Activity.class %>" />
<c-rt:set var="activityReporter" value="<%= org.internna.iwebjtracker.spring.mvc.IWebJTrackerModelDecoratorInterceptor.ACTIVITY_REPORTER %>" />
<c:set var="statistics" value="${requestScope[activityReporter].projectsStatistics}" />
<iwebmvc:panel title="ui.administration.statistics" width="99%;margin:0">
    <table style="text-align:left;width:95%">
        <tbody>
            <tr>
                <td style="font-weight:bold"><iwebmvc:message argMessage="ui.project.statistics.totalprojects" /></td>
                <td style="text-align:right">${statistics[totalProjects]}</td>
            </tr>
            <tr>
                <td style="font-weight:bold"><iwebmvc:message argMessage="ui.project.statistics.totalopen" /></td>
                <td style="text-align:right">${statistics[totalOpenIssues]}</td>
            </tr>
            <tr>
                <td style="font-weight:bold;padding-left:15px"><iwebmvc:message argMessage="ui.project.statistics.totalcritical" /></td>
                <td style="text-align:right">${statistics[totalCritical]}</td>
            </tr>
            <tr>
                <td style="font-weight:bold;padding-left:15px"><iwebmvc:message argMessage="ui.project.statistics.totalassigned" /></td>
                <td style="text-align:right">${statistics[totalAssigned]}</td>
            </tr>
            <tr>
                <td style="font-weight:bold"><iwebmvc:message argMessage="ui.project.statistics.totalactivity" /></td>
                <td style="text-align:right">${statistics[totalActivity]}</td>
            </tr>
            <tr>
                <td style="font-weight:bold"><iwebmvc:message argMessage="ui.project.statistics.totaldevelopers" /></td>
                <td style="text-align:right">${statistics[totalDevelopers]}</td>
            </tr>
        </tbody>
    </table>
</iwebmvc:panel>
<div class="panelSeparator"></div>
<iwebmvc:panel title="ui.activity.pietype" width="99%;margin:0;padding:0" cssStyle="text-align:left">
    <div id="activitiesByTypeChart" style="height:170px;padding:0;margin:0;width:100%;overflow:hidden"></div>
</iwebmvc:panel>
<div class="panelSeparator"></div>
<iwebmvc:panel title="ui.activity.piepriority" width="99%;margin:0;padding:0;" cssStyle="text-align:left">
    <div id="activitiesByPriorityChart" style="height:170px;padding:0;margin:0;width:100%;overflow:hidden"></div>
</iwebmvc:panel>
<script type="text/javascript">
    dojo.addOnLoad(function() {
        var activitiesByTypeChartSerie = [], activitiesByPriorityChartSerie = [];
        <c:forEach items="${requestScope[activityReporter].recentActivityByType}" var="row" varStatus="loop">
            activitiesByTypeChartSerie.push({legend: '<iwebmvc:message argMessage="ActivityType.${row[0]}" />', text:${row[1]}, y: ${row[1]}});
        </c:forEach>
        paintGooglePieChart(byId("activitiesByTypeChart"), activitiesByTypeChartSerie);
        <c:forEach items="${requestScope[activityReporter].recentActivityByPriority}" var="row" varStatus="loop">
            activitiesByPriorityChartSerie.push({legend: '<iwebmvc:message argMessage="ActivityType.${row[0]}" />', text:${row[1]}, y: ${row[1]}});
        </c:forEach>
        paintGooglePieChart(byId("activitiesByPriorityChart"), activitiesByPriorityChartSerie);
    });
</script>